import React, { Component } from 'react';
import { withRouter, SingletonRouter } from 'next/router';
import { Grid } from '@alifd/next';

const { Row, Col } = Grid;

interface Props {
    router?: SingletonRouter
}

interface State {
    menu: Array<object>
}

@(withRouter as any)
class Menu extends Component<Props, State>{

    state = {
        menu: [
            {
                path: '/algorithm',
                title: "十进制转换二进制，除2取余法，通过递归连续除以2得到的余数"
            },
            {
                path: '/quicksort',
                title: "快速排序"
            },
        ]
    }

    render() {
        const { menu } = this.state;
        return (
            <div role="grid" style={{ padding: 20, fontSize: 16 }}>
                <Row justify="center" wrap>
                    {
                        menu.map((item, key): any => {
                            return <Col key={key} span={24} style={{ textAlign: "left",margin:5}}> <a  href={item.path}>{key + 1}、{item.title}</a>   </Col>
                        })
                    }



                </Row>
            </div>
        )
    }
}

export default Menu;